import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';
import { stripesConnect, IfPermission } from '@folio/stripes/core';

import { MultiColumnList, Button } from '@folio/stripes/components';

class WaitMealList extends Component {
  constructor(props) {
    super(props);
    this.logger = props.stripes.logger;
    this.log = this.logger.log.bind(this.logger);
    this.state = {
      searchForm: {},
      editOpen: false,
      editParams: {}
    };
  }

    add = () => {

    }

    render() {
      const formatter = {
        username: (
            <FormattedMessage id="ui-party.search.partyLog.username" />
        ),
        barcode: (
            <FormattedMessage id="ui-party.loans.columns.readerAccount" />
        ),
        edit: <FormattedMessage id="ui-party.loans.columns.operating" />

      };
      return (
        <div>
          <MultiColumnList
            interactive={false}
            height={200}
            isEmptyMessage={<FormattedMessage id="ui-party.empty.list" />} // 空数据提示
            virtualize
            contentData={this.props.dataList}
            columnMapping={formatter}
            columnWidths={{
              username: '33%',
              barcode: '33%',
              edit:'33%',
            }}
            visibleColumns={[
              'username',
              'barcode',
              'edit'
            ]}
            formatter={{
              edit: item => [
                <Button onClick={() => { this.props.removeUser(item); }}>
                  <FormattedMessage id="ui-party.loans.columns.operating.remove" />
                </Button>
              ],
              serialNumber: item => [<span>{item.rowIndex + 1}</span>]

            }}
          />

        </div>

      );
    }
}

export default injectIntl(stripesConnect(WaitMealList));
